import QtQuick 2.0

Item {
    id: grand
    anchors.fill: parent
    property int cH: bg_rec1.height+bg_rec2.height+2
    property string val: ""
    property string bg1: "grey"
    property string b1c1: "Ghostwhite"
    property string b1c2: "Limegreen"
    property int b1h: 40
    property int b1w: 40

    Rectangle
    {
        id:bg_rec1
        color:bg1
        width: parent.width
        height: parent.b1h*4+30
    }
    Column{
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.top: parent.top
        anchors.topMargin: parent.y + 10
        spacing: 2
        Row{
            spacing: 2
            Rectangle
            {
                property string val: "1"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {

                        if(grand.val.length < 7)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                property string val: "2"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                property string val: "3"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }

            }

        }
        Row{
            spacing: 2
            Rectangle
            {
                property string val: "4"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                property string val: "5"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                property string val: "6"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }

        }
        Row{
            spacing: 2
            Rectangle
            {
                property string val: "7"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                property string val: "8"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                property string val: "9"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }

        }
        Row{
            spacing: 2
            Rectangle
            {
                property string val: "0"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length < 6)
                            grand.val = grand.val + parent.val
                    }
                }
            }
            Rectangle
            {
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: "del"
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    hoverEnabled: true;
                    onClicked:
                    {
                        if(r_o_o_t.delVis)
                            r_o_o_t.delVis = false
                        else
                            r_o_o_t.delVis = true
                    }
                }
            }
            Rectangle
            {
                property string val: "Bs"
                height:  b1h
                width: b1w
                color: b1c1
                Text
                {
                    anchors.fill: parent
                    text: parent.val
                    font.pointSize: 15
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    color:b1c2
                }
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        if(grand.val.length > 0)
                            grand.val = grand.val.slice(0,-1)
                    }
                }
            }
        }

    }
    Rectangle
    {
        id: bg_rec2
        color:bg1
        width: parent.width
        height: parent.b1h
        anchors.top: bg_rec1.bottom
        anchors.topMargin: 1
        Text
        {
            anchors.fill: parent
            text: grand.val
            font.pointSize: 24
            color:"#505050"
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter

        }
        MouseArea
        {
            anchors.fill: parent
            onClicked:
            {
                numBoard.addItem(grand.val)
                grand.val = ""
            }
        }
    }
}

